<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@taglib uri="/WEB-INF/tld/components.tld" prefix="up"%>
<%@taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page import="edu.up.beans.SonhoBean"%>
<%@page import="edu.up.controle.Sonho"%>
<html>
<jsp:include page="header.jsp">
	<jsp:param name="function" value="Carrinho de Compras" />
</jsp:include>
<jsp:useBean id="listadeCompra" scope="session"
	class="edu.up.beans.SonhoBean" />
<jsp:useBean id="listaSonhoBean" scope="session"
	class="edu.up.beans.SonhoBean" />

<body>
<!-- begin #container -->
<div id="container"><!-- begin #header -->
<div id="header">
<div class="headerBackground"></div>
<div id="navcontainer">
<ul id="navlist">
	<li><a href="index.jsp"><up:label property="menu.home" /></a></li>
	<li><a href="Sonhos.jsp"><up:label property="menu.sonhos" /></a></li>
	<li><a
		href="<%=request.getContextPath()%>/RelatoriosServlet?acao=RelDepoimentos"><up:label
		property="menu.depoimentos" /></a></li>
	<li><a href="Login.jsp"><up:label property="menu.login" /></a></li>
	<li><a href="Sobre.jsp"><up:label property="menu.sobre" /></a></li>
	<li><up:countryOption country="Brasil" locale="pt_BR" /></li>
	<li><up:countryOption country="USA" locale="en_US" /></li>
	<li><up:countryOption country="Espanha" locale="es_ES" /></li>
</ul>
</div>
</div>
<!-- end #header --> <!-- begin #mainContent -->
<div id="mainContent">
<div class="t">
<div class="b">
<div class="l">
<div class="r">
<div class="bl">
<div class="br">
<div class="tl">
<div class="tr">
<h1>Carrinho de Compras</h1>
<form id="frmLista" name="frmLista" method="post">
<script>
            function validar(paramAcao)
			{
		
            	document.frmLista.action="<%=request.getContextPath()%>/CarrinhoServlet?acao=" + paramAcao;
			document.frmLista.submit();
		
			}
            
            function get_radio_value()
            {
            for (var i=0; i < document.frmLista.rdId.length; i++)
               {
               if (document.frmLista.rdId[i].checked)
                  {
                  var rad_val = document.frmLista.rdId[i].value;
                  alert(rad_val);
                  
                  }
               }
            }
            
            </script>
<table border="1">
	<tr>
		<th>Id</th>
		<th>Data</th>
		<th>Valor</th>
		<th>Foto</th>
		<th>lugar</th>
		<th>Fornecedor</th>
		<th>Descricao</th>
		<th>Tipo</th>
	</tr>
	<%  
            		//ArrayList<SonhoBean> list = (ArrayList<SonhoBean>) request.getAttribute("listaSonhoBean");
            		ArrayList<SonhoBean> var = (ArrayList<SonhoBean>) request.getAttribute("listadeCompra");
            		Sonho sonho = new Sonho();
        			ArrayList<SonhoBean> list = sonho.pegaDados(var);
            		
            		for (int i = 0; i < list.size(); i++) { %>
	<TR>
		<TD><input type="radio" name="rdId" id="rdId"
			value="<%=list.get(i).getId() %>" /></TD>

		<TD><%=list.get(i).getData() %></TD>

		<TD><%=list.get(i).getValor() %></TD>

		<TD><%=list.get(i).getFoto() %></TD>

		<TD><%=list.get(i).getLugar() %></TD>

		<TD><%=list.get(i).getFornecedor() %></TD>

		<TD><%=list.get(i).getDescricao() %></TD>

		<TD><%=list.get(i).getTipo() %></TD>
	</TR>
	<%  } %>

</table>
<p><input type="button" name="btnFinalizar" value="Finalizar"
	onclick="javascript:validar('Finalizar')" /></p>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</div>
<!-- end #mainContent --> <!-- begin #footer -->
<div id="footer">

<div class="social"></div>
<script type="text/javascript">
					// BeginOAWidget_Instance_2149023: #social
				
					$('.social').jsocial({
							twitter		:  'cefalonx',
							facebook	:  'facebook.com/bruno.aizawa',
							youtube		:  'youtube.com/cefalonx',
							center		: false,	
							inline		: true,
							small		: false,
							newPage		: false
						});
				

					// EndOAWidget_Instance_2149023
				  </script>

<p><up:label property="rodape.texto" /></p>
</div>
<!-- end #footer --></div>
<!-- end #container -->
</body>
</html>
